// import WrapperRouteComponent from './config'
import { Navigate, useRoutes } from 'react-router'
import Login from '@/pages/Login'
import Dashboard from '@/pages/Dashboard/index.jsx'
import WrapperRouteComponent from '@/router/config.jsx'
import Products from '@/pages/Products/index.jsx'
import Home from "@/pages/Home/index.jsx";

const RenderRouter = () => {
	const element = useRoutes([
		{
			path: '/',
			element: <Navigate to="/login" />,
		},
		{
			path: 'login',
			element: <Login />,
		},
		{
			path: 'dashboard',
			element: (
				<WrapperRouteComponent auth={true}>
					<Dashboard />
				</WrapperRouteComponent>
			),
			children: [
				{
					path: '',
					element: <Navigate to="/dashboard/home" />,
				},
				{
					path: 'home',
					element: (
						<WrapperRouteComponent auth={true}>
							<Home />
						</WrapperRouteComponent>
					),
				},
				{
					path: 'products',
					element: (
						<WrapperRouteComponent auth={true}>
							<Products />
						</WrapperRouteComponent>
					),
				},
			],
		},
	])
	return element
}

export default RenderRouter
